```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>算法可视化：子集问题</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', 'Noto Serif SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background-color: #f8fafc;
            color: #1e293b;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
        }
        .code-block {
            background-color: #1e293b;
            color: #e2e8f0;
            border-left: 4px solid #8b5cf6;
        }
        .concept-card {
            transition: all 0.3s ease;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        }
        .concept-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
        }
        .indent-first-line::first-letter {
            font-size: 2.5em;
            float: left;
            line-height: 0.9;
            margin-right: 8px;
            color: #6366f1;
            font-weight: bold;
        }
    </style>
</head>
<body class="min-h-screen">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-4 md:px-0">
        <div class="container mx-auto max-w-4xl text-center">
            <div class="flex justify-center mb-6">
                <div class="bg-white bg-opacity-20 rounded-full p-3 inline-flex">
                    <i class="fas fa-code text-2xl"></i>
                </div>
            </div>
            <h1 class="text-4xl md:text-5xl font-bold mb-4">子集问题解析与可视化</h1>
            <p class="text-xl md:text-2xl font-light mb-8 max-w-2xl mx-auto">探索回溯算法在解决子集问题中的精妙应用</p>
            <div class="flex justify-center space-x-4">
                <a href="#problem" class="bg-white text-indigo-600 px-6 py-3 rounded-full font-medium hover:bg-opacity-90 transition">问题描述</a>
                <a href="#solution" class="bg-white bg-opacity-20 px-6 py-3 rounded-full font-medium hover:bg-opacity-30 transition">解决方案</a>
            </div>
        </div>
    </section>

    <!-- Problem Section -->
    <section id="problem" class="py-16 px-4 md:px-0">
        <div class="container mx-auto max-w-4xl">
            <div class="flex items-center mb-8">
                <div class="w-12 h-12 rounded-full bg-indigo-100 flex items-center justify-center mr-4">
                    <i class="fas fa-question text-indigo-600 text-xl"></i>
                </div>
                <h2 class="text-3xl font-bold text-gray-800">问题描述</h2>
            </div>
            
            <div class="bg-white rounded-xl p-8 shadow-lg mb-12">
                <p class="text-lg indent-first-line leading-relaxed mb-6">
                    给定一个不含重复元素的整数数组 nums，返回该数组所有可能的子集（幂集）。解集不能包含重复的子集。
                </p>
                
                <div class="bg-indigo-50 rounded-lg p-6 mb-6">
                    <h3 class="text-xl font-semibold text-indigo-700 mb-3 flex items-center">
                        <i class="fas fa-lightbulb mr-2"></i> 理解子集问题
                    </h3>
                    <p class="text-gray-700">
                        子集问题要求我们找出给定集合的所有可能子集。例如，对于集合 [1,2,3]，其所有子集包括：
                        <span class="font-mono bg-gray-100 px-2 py-1 rounded">[], [1], [2], [3], [1,2], [1,3], [2,3], [1,2,3]</span>。这
                        共包含 2^n 个子集（n为集合中元素的数量）。
                    </p>
                </div>
                
                <div class="mermaid mb-6">
                    graph TD
                        A[Input: [1,2,3]] --> B[Start with empty subset []]
                        B --> C[Add 1 to create [1]]
                        B --> D[Skip 1, keep []]
                        C --> E[Add 2 to create [1,2]]
                        C --> F[Skip 2, keep [1]]
                        D --> G[Add 2 to create [2]]
                        D --> H[Skip 2, keep []]
                        E --> I[Add 3 to create [1,2,3]]
                        E --> J[Skip 3, keep [1,2]]
                        F --> K[Add 3 to create [1,3]]
                        F --> L[Skip 3, keep [1]]
                        G --> M[Add 3 to create [2,3]]
                        G --> N[Skip 3, keep [2]]
                        H --> O[Add 3 to create [3]]
                        H --> P[Skip 3, keep []]
                </div>
            </div>
        </div>
    </section>

    <!-- Solution Section -->
    <section id="solution" class="py-16 px-4 md:px-0 bg-gray-50">
        <div class="container mx-auto max-w-4xl">
            <div class="flex items-center mb-8">
                <div class="w-12 h-12 rounded-full bg-green-100 flex items-center justify-center mr-4">
                    <i class="fas fa-code text-green-600 text-xl"></i>
                </div>
                <h2 class="text-3xl font-bold text-gray-800">解决方案</h2>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div class="concept-card bg-white rounded-xl p-6">
                    <div class="flex items-center mb-4">
                        <div class="w-10 h-10 rounded-full bg-purple-100 flex items-center justify-center mr-3">
                            <i class="fas fa-sitemap text-purple-600"></i>
                        </div>
                        <h3 class="text-xl font-semibold">回溯算法</h3>
                    </div>
                    <p class="text-gray-700 mb-4">
                        回溯法通过系统地遍历所有可能的解空间来寻找解决方案。对于子集问题，我们可以在每个步骤决定是否包含当前元素。
                    </p>
                    <ul class="space-y-2 text-gray-700">
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>时间复杂度：O(2^n) - 需要生成所有2^n个子集</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                            <span>空间复杂度：O(n) - 递归栈的深度最多为n</span>
                        </li>
                    </ul>
                </div>
                
                <div class="concept-card bg-white rounded-xl p-6">
                    <div class="flex items-center mb-4">
                        <div class="w-10 h-10 rounded-full bg-blue-100 flex items-center justify-center mr-3">
                            <i class="fas fa-project-diagram text-blue-600"></i>
                        </div>
                        <h3 class="text-xl font-semibold">递归过程</h3>
                    </div>
                    <p class="text-gray-700 mb-4">
                        递归函数在每个步骤：
                    </p>
                    <ol class="list-decimal list-inside space-y-2 text-gray-700">
                        <li>将当前子集添加到结果中</li>
                        <li>遍历剩余元素，逐个尝试添加到当前子集</li>
                        <li>递归处理下一个元素</li>
                        <li>回溯（移除最后一个添加的元素）</li>
                    </ol>
                </div>
            </div>
            
            <div class="bg-white rounded-xl overflow-hidden shadow-lg">
                <div class="bg-gray-800 px-6 py-4 flex items-center">
                    <div class="w-3 h-3 rounded-full bg-red-500 mr-2"></div>
                    <div class="w-3 h-3 rounded-full bg-yellow-500 mr-2"></div>
                    <div class="w-3 h-3 rounded-full bg-green-500 mr-4"></div>
                    <div class="text-gray-300 text-sm">subsets.py</div>
                </div>
                <div class="code-block p-6 overflow-x-auto">
                    <pre class="font-mono text-sm md:text-base"><code class="language-python">def subsets(nums):
    result = []
    def backtrack(start, curr):
        result.append(curr[:])  # 添加当前子集的副本
        for i in range(start, len(nums)):
            curr.append(nums[i])  # 包含当前元素
            backtrack(i + 1, curr)  # 递归处理后续元素
            curr.pop()  # 回溯，不包含当前元素
    
    backtrack(0, [])
    return result</code></pre>
                </div>
            </div>
            
            <div class="mt-12 grid md:grid-cols-2 gap-8">
                <div>
                    <h3 class="text-xl font-semibold mb-4 flex items-center">
                        <i class="fas fa-list-ol mr-2 text-indigo-600"></i> 示例执行过程
                    </h3>
                    <div class="bg-white rounded-lg p-6 shadow">
                        <p class="font-medium mb-2">输入: [1,2,3]</p>
                        <p class="text-sm text-gray-600 mb-4">执行步骤:</p>
                        <ol class="list-decimal list-inside space-y-2 text-sm">
                            <li>开始: []</li>
                            <li>添加1: [1]</li>
                            <li>递归处理[2,3]</li>
                            <li>添加2: [1,2]</li>
                            <li>递归处理[3]</li>
                            <li>添加3: [1,2,3]</li>
                            <li>回溯到[1,2]</li>
                            <li>回溯到[1]</li>
                            <li>添加3: [1,3]</li>
                            <li>回溯到[]</li>
                            <li>添加2: [2]</li>
                            <li>...以此类推</li>
                        </ol>
                    </div>
                </div>
                <div>
                    <h3 class="text-xl font-semibold mb-4 flex items-center">
                        <i class="fas fa-chart-bar mr-2 text-green-600"></i> 复杂度分析
                    </h3>
                    <div class="bg-white rounded-lg p-6 shadow">
                        <div class="mb-4">
                            <p class="font-medium">时间复杂度: O(2^n)</p>
                            <div class="w-full bg-gray-200 rounded-full h-2.5 mt-2">
                                <div class="bg-red-600 h-2.5 rounded-full" style="width: 100%"></div>
                            </div>
                            <p class="text-xs text-gray-500 mt-1">指数级增长，n=20时约百万级操作</p>
                        </div>
                        <div>
                            <p class="font-medium">空间复杂度: O(n)</p>
                            <div class="w-full bg-gray-200 rounded-full h-2.5 mt-2">
                                <div class="bg-blue-600 h-2.5 rounded-full" style="width: 20%"></div>
                            </div>
                            <p class="text-xs text-gray-500 mt-1">线性增长，仅考虑递归栈空间</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Visualization Section -->
    <section class="py-16 px-4 md:px-0">
        <div class="container mx-auto max-w-4xl">
            <div class="flex items-center mb-8">
                <div class="w-12 h-12 rounded-full bg-orange-100 flex items-center justify-center mr-4">
                    <i class="fas fa-project-diagram text-orange-600 text-xl"></i>
                </div>
                <h2 class="text-3xl font-bold text-gray-800">算法可视化</h2>
            </div>
            
            <div class="bg-white rounded-xl p-8 shadow-lg">
                <div class="mermaid">
                    %%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#f0f9ff', 'edgeLabelBackground':'#fff'}}}%%
                    flowchart TD
                        A["subsets([1,2,3])"] --> B["backtrack(0, [])"]
                        B --> C["添加 [] 到结果"]
                        B --> D["循环 i=0 to 2"]
                        D --> E["i=0: curr=[1]"]
                        E --> F["backtrack(1, [1])"]
                        F --> G["添加 [1] 到结果"]
                        F --> H["循环 i=1 to 2"]
                        H --> I["i=1: curr=[1,2]"]
                        I --> J["backtrack(2, [1,2])"]
                        J --> K["添加 [1,2] 到结果"]
                        J --> L["循环 i=2 to 2"]
                        L --> M["i=2: curr=[1,2,3]"]
                        M --> N["backtrack(3, [1,2,3])"]
                        N --> O["添加 [1,2,3] 到结果"]
                        N --> P["循环结束"]
                        M --> Q["回溯: curr=[1,2]"]
                        L --> R["循环结束"]
                        J --> S["回溯: curr=[1]"]
                        H --> T["i=2: curr=[1,3]"]
                        T --> U["backtrack(3, [1,3])"]
                        U --> V["添加 [1,3] 到结果"]
                        U --> W["循环结束"]
                        T --> X["回溯: curr=[1]"]
                        H --> Y["循环结束"]
                        F --> Z["回溯: curr=[]"]
                        D --> AA["i=1: curr=[2]"]
                        AA --> AB["backtrack(2, [2])"]
                        AB --> AC["添加 [2] 到结果"]
                        AB --> AD["循环 i=2 to 2"]
                        AD --> AE["i=2: curr=[2,3]"]
                        AE --> AF["backtrack(3, [2,3])"]
                        AF --> AG["添加 [2,3] 到结果"]
                        AF --> AH["循环结束"]
                        AE --> AI["回溯: curr=[2]"]
                        AD --> AJ["循环结束"]
                        AB --> AK["回溯: curr=[]"]
                        D --> AL["i=2: curr=[3]"]
                        AL --> AM["backtrack(3, [3])"]
                        AM --> AN["添加 [3] 到结果"]
                        AM --> AO["循环结束"]
                        AL --> AP["回溯: curr=[]"]
                        D --> AQ["循环结束"]
                </div>
                
                <div class="mt-8">
                    <h3 class="text-xl font-semibold mb-4 flex items-center">
                        <i class="fas fa-check-circle mr-2 text-green-600"></i> 最终结果
                    </h3>
                    <div class="grid grid-cols-2 md:grid-cols-4 gap-3">
                        <div class="bg-indigo-50 p-3 rounded text-center">[]</div>
                        <div class="bg-indigo-50 p-3 rounded text-center">[1]</div>
                        <div class="bg-indigo-50 p-3 rounded text-center">[2]</div>
                        <div class="bg-indigo-50 p-3 rounded text-center">[3]</div>
                        <div class="bg-indigo-50 p-3 rounded text-center">[1,2]</div>
                        <div class="bg-indigo-50 p-3 rounded text-center">[1,3]</div>
                        <div class="bg-indigo-50 p-3 rounded text-center">[2,3]</div>
                        <div class="bg-indigo-50 p-3 rounded text-center">[1,2,3]</div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>
```